﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OleDb;
using Oracle.DataAccess.Client;

namespace eepg_contratos.Models
{
    #region ConexionModels
    public class ConexionModel
    {
        public OracleConnection DesarrolloContratos
        {
            get
            {
                return new OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["desarrollo_contratos"].ConnectionString);

            }
        }

        public OracleConnection DesarrolloRenova
        {
            get
            {
                return new OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["desarrollo_renova"].ConnectionString);

            }
        }

        public OracleConnection ProduccionRenova
        {
            get
            {
                return new OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["produccion_renova"].ConnectionString);

            }
        }

        public OracleConnection ProduccionIntranet
        {
            get
            {
                return new OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["produccion_intranet"].ConnectionString);

            }
        }

        public OracleConnection ProduccionCGWEBFinan
        {
            get
            {
                return new OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["produccion_cgweb_finan"].ConnectionString);

            }
        }

    }
    #endregion

    #region ConexionServices
    public class ConexionServices
    {
        public DataTable Consultar(String sql)
        {
            OracleConnection conn = new OracleConnection();
            OracleDataAdapter da = new OracleDataAdapter();
            DataTable dt = new DataTable();
            ConexionModel cm = new ConexionModel();

            conn = cm.DesarrolloContratos;
            da.SelectCommand = new OracleCommand(sql, conn);
            conn.Open();
            try
            { da.Fill(dt); }
            finally
            { conn.Close(); }

            return dt;
        }

 
    }
    #endregion
}